
import { defineStore } from 'pinia'

// import axios from 'axios'
export const useCounterStore = defineStore('counter', () => { 
    // 数据(state)
    const count = ref(0)
    const message=ref('小熊')
    // 修改数据的方法(action)
    const increment = () => { 
        count.value++
    }
    //getter
    const doubleCount = computed(() => count.value * 2)
    //异步action
    const getList = async () => { 
        // const res = await axios.request<接口数据类型>({})
    }
    // 以对象形式返回
    return {count,increment,doubleCount,getList,message}
}, {
    persist: {
        enabled:true
    } 
})